﻿var launch_message;

document.addEventListener('myCustomEvent', function(evt) {
console.log(evt.detail);
chrome.runtime.sendMessage({type: "launch", message: evt.detail}, function(response) {
    console.log(response);

    var evt = document.createEvent("CustomEvent");
    evt.initCustomEvent('myExeResponseEvent', true, false, response);
    // fire the event
    document.dispatchEvent(evt);
});

}, false);